#ifndef _WIDGET_H_
#define _WIDGET_H_

#include <displayObject.h>

#include <goocanvas.h>
#include <map>

namespace lgb_gtk
{

  class Container;
  void OnWidgetAnimationFinished(GooCanvasItem *item,
				 gboolean       stopped,
				 gpointer       user_data);
  
  class Widget : virtual public DisplayObject
  {
  protected:
    //GooCanvasItem *father;
    GooCanvasItem *canvas;
    bool animating;
    std::map<int (*)(void*), void*> animationFinishedFunctions;
    int animationCompleteHandlerID;

    virtual int Init() = 0;
    
  public:
    //these functions is for Container , Not user !
    int AddTo(GooCanvasItem *newFather);
    int Alone();

    friend void OnWidgetAnimationFinished(GooCanvasItem *item,
					  gboolean       stopped,
					  gpointer       user_data);
    int AnimationFinishedBaseFunctions();

  public:
    Widget();
    ~Widget();

    virtual string Type() = 0;
    int MoveTo(double x, double y , double time);
    //int MoveTo(double x, double y , double scale , double degrees , bool absolute , double time);
    int AddMoveCompleteFunction(int (*f)(void *data), void *data);
  };

}

#endif
